package com.innerclass;
/*
* 测试内部类的用法
* */

public class Outer {
    private int age = 10;
    public void show(){
        System.out.println("Outer.show");
        System.out.println(age);
    }

    public class Inner{
        int age = 20;
        public void show(){
            System.out.println("Inner.show");
//            System.out.println(age);
            System.out.println(this.age);
            //非静态内部类访问外部类属性：外部类名.this.变量名
            System.out.println(Outer.this.age);
            Outer.this.show();
        }
    }

    public static void main(String[] args) {
        Outer a = new Outer();
        Outer.Inner b = a.new Inner();
//        System.out.println(b.age);
        b.show();
    }
}
